import { Http } from "../utils/http";

class Theme{
    static locationA = "t-1";
    static locationE = "t-2";
    static locationF = "t-3";
    static locationH = "t-4";

    themes = [];

    async getThemes() {
        const names = `${Theme.locationA},${Theme.locationE},${Theme.locationF},${Theme.locationH}`;
        this.themes = await Http.request({
            url: "themes/by/names",
            data: {
                names
            }
        })
    }

    getHomeLocationaA(){
        return this.themes.find(t => t.name === Theme.locationA);
    }

    getHomeLocationaE(){
        return this.themes.find(t => t.name === Theme.locationE);
    }

    getHomeLocationaF(){
        return this.themes.find(t => t.name === Theme.locationF);
    }

    getHomeLocationaH(){
        return this.themes.find(t => t.name === Theme.locationH);
    }

    static getHomeLocationESpu() {
        return Theme.getThemeSpuByName(Theme.locationE);
    }

    static getThemeSpuByName(name) {
        return Http.request({
            url: `theme/name/${name}/with_spu`
        });
    }

}

export {
    Theme
}